<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>上海泛软科技有限公司-后台登陆</title>
<meta name="robots" content="nofollow" />
<meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=1″>
<link href="/Public/Css/admin-style.css" rel="stylesheet" type="text/css" />
<link href="/Public/Css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="/Public/Css/bootstrap.min.css" rel="stylesheet" type="text/css" />


<script language="javascript" type="text/javascript" src="/Public/Js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/admin-common.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/bootstrap.min.js"></script>
<!--<script language="javascript" type="text/javascript" src="/Public/Js/bootstrap.js"></script> -->
<script language="javascript" type="text/javascript" src="/Public/Js/rock_customer_list.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/demo.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/blob.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/FileSaver.min.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/jquery.base64.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/jquery-1.10.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/tableExport.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/xlsx.core.min.js"></script>
</head>

<body>

 <h4>用户增加</h4>
  <form class="form-horizontal" role="form" style="width:100%;" enctype="multipart/form-data" name="form1" method="post" action="<?php echo U('user_Management_Add_OK');?>">
  
    <div style="width:80%; border: 1px solid #ccc;padding:10px;margin-bottom:30px;margin-left:10%"> 
	<div style="width:60%;margin-left:15%">  	 
	 <h4>用户信息:</h4>
	
	    <div class="form-group user_new">
		 <label for="" class="col-sm-2 control-label">姓名:</label>
		 <div class="col-sm-10">
		  <input required="required"  type="text" class="form-control" name="add_user_name" id="add_user_name" placeholder="请输入用户姓名">
		</div>
	   </div>
	   <div class="form-group user_new">
		 <label for="" class="col-sm-2 control-label">密码:</label>
		 <div class="col-sm-10">
		  <input required="required"   type="password" class="form-control" name="add_user_password" id="add_user_password" placeholder="请输入用密码">
		</div>
	   </div>
	    <div class="form-group user_new">
		 <label for="" class="col-sm-2 control-label">手机号:</label>
		 <div class="col-sm-10">
		  <input required="required"  type="text" class="form-control" name="add_user_Tel" id="add_user_Tel" placeholder="请输入手机号">
		</div>
	   </div>
	   <div class="form-group user_new">
		 <label for="" class="col-sm-2 control-label">职位:</label>
		 <div class="col-sm-10">
		  <input required="required"  type="text" class="form-control" name="add_user_postion" id="add_user_postion" placeholder="请输入职位">
		</div>
	   </div>
	   <div class="form-group user_new">
		 <label for="" class="col-sm-2 control-label">工作区域:</label>
		 <div class="col-sm-10">
		  <input required="required"  type="text" class="form-control" name="add_user_work" id="add_user_work" placeholder="请输入工作区域">
		</div>
	   </div>
	 </div>
    </div>	
    <div style="width:80%; border: 1px solid #ccc;padding:10px;margin-bottom:30px;margin-left:10%"> 
	<div style="width:60%;margin-left:15%">  	 
	 <h4>医院信息:</h4>
	 <div class="form-group old_hos">
		<label for="" class="col-sm-2 control-label">医院</label>
		<div class="col-sm-10">
		  <select style="width:100%" name="hospital_name" id="hospital_name" onchange="choose_hos()">
			<?php if(is_array($hos_name)): $i = 0; $__LIST__ = $hos_name;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$hospital_name): $mod = ($i % 2 );++$i;?><option h_id="<?php echo ($hospital_name['h_id']); ?>"><?php echo ($hospital_name["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
		  </select>	
		</div>
	  </div>
	   <input style="display:none" type="text" class="form-control" name="add_hosid" id="add_hosid" placeholder="">
		 
	  <a id="new_hos" onclick="new_hos()">增加新的医院</a>
	  <div class="form-group new_add_hos">
		<label for="" class="col-sm-2 control-label">医院名称:</label>
		<div class="col-sm-10">
		  <input  type="text" class="form-control" name="add_hos_name" id="add_hos_name" placeholder="请输入医院名称">
		</div>
	  </div>
	  
	  <div class="form-group new_add_hos">
		<label for="" class="col-sm-2 control-label">省份:</label>
		<div class="col-sm-10">
		  <input  type="text" class="form-control" name="add_province" id="add_province" placeholder="请输入城市">
		</div>
	  </div>
	  <div class="form-group new_add_hos">
		<label for="" class="col-sm-2 control-label">城市、区、县</label>
		<div class="col-sm-10">
		  <input  type="text" class="form-control" name="add_city" id="add_city" placeholder="请输入区、县">
		</div>
	  </div>
	  <div class="form-group new_add_hos">
		<label for="" class="col-sm-2 control-label">经纬度</label>
		<div class="col-sm-10">
		  <input  style="width:40%;float:left;margin-right:5%" type="text" class="form-control" name="add_lng" id="add_lng" placeholder="请输入经度">
		  <input  style="width:40%;float:left;margin-right:2%" type="text" class="form-control" name="add_lat" id="add_lat" placeholder="请输入纬度">
		  <button type="button" class="btn btn-primary btn-sm" onclick="obtain_lng_lat()">获取</button>
		</div>
	  </div>
	 </div>
    </div>	
	<div class="form-group" style="text-align:right;margin-right:10%">
       <div class="col-sm-offset-2 col-sm-10">
         <button type="submit" class="btn btn-info sub_data">提交</button>
       </div>
    </div>

 </form>
 <script>
  //增加新的医院
  $(".new_add_hos").css("display","none");
  function new_hos(){
    
	if($("#new_hos").html() == "选择现有的医院"){
	  $(".new_add_hos").css("display","none");
	  $(".old_hos").css("display","block");
	  $("#new_hos").html("增加新的医院");
	  $(".new_add_hos").children().next().children().attr("required",false);
	  choose_hos();
	}else{
	  $(".new_add_hos").css("display","block");
	  $(".old_hos").css("display","none");
	  $("#new_hos").html("选择现有的医院");
	  $("#add_hosid").val("");
	  $(".new_add_hos").children().next().children().attr("required","required");
	}
  }
  //选择现有的医院
  choose_hos();
  function choose_hos(){
    var h_id = $("#hospital_name option:selected").attr("h_id");
	$("#add_hosid").val(h_id);//拿到医院id
	 
  }
  //获取医院的经纬度
  function obtain_lng_lat(){
     var hos_name1 = $("#add_hos_name").val();
	 $.ajax({
  	    url: '/javajy/index.php/Admin/Wenlian/from_Name_GetData',
  	    type: 'POST',
 	    dataType: 'JSON',//here
		data:{
		   hos_name:hos_name1
		 },
 	     success: function(data){
          if(data["lng"]&& data["lat"]){
		     $("#add_lng").val(data["lng"]);
		     $("#add_lat").val(data["lat"]);
		  }else{
		     alert(data);
			$("#add_lng").val('');
		    $("#add_lat").val('');
		  }		 
		 }
	   });
  }
 </script>

</body>
</html>